﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:WpfChartingControlLibrary.BarCharts">

    <Style TargetType="{x:Type local:BarChartControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:BarChartControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" Focusable="True">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Name="column1" Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Name="row1" Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock Margin="2" x:Name="PART_TitleTextBlock" Grid.Column="1" Grid.Row="0" 
                RenderTransformOrigin="0.5,0.5" FontSize="14" FontWeight="Bold" 
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Center" 
                Text="{Binding Path=Title, RelativeSource={RelativeSource TemplatedParent}}"/>

                        <TextBlock Margin="2" x:Name="PART_XLabelTextBlock" Grid.Column="1" Grid.Row="2" 
               RenderTransformOrigin="0.5,0.5" TextAlignment="Center" 
               Text="{Binding Path=XAxisTitle, RelativeSource={RelativeSource TemplatedParent}}"/>

                        <TextBlock Margin="2" Name="PART_YLabelTextBlock" Grid.Column="0" Grid.Row="1" 
                RenderTransformOrigin="0.5,0.5" TextAlignment="Center" 
                Text="{Binding Path=YAxisTitle, RelativeSource={RelativeSource TemplatedParent}}">
                            <TextBlock.LayoutTransform>
                                <RotateTransform Angle="-90"/>
                            </TextBlock.LayoutTransform>
                        </TextBlock>

                            <Grid  Margin="0" x:Name ="PART_ChartGrid" Grid.Column="1" Grid.Row="1"
			                                        ClipToBounds="True" Background="Transparent"/>

                        <!--todo implement scrolling for large chart-->
<!--<ScrollViewer Grid.Column="1" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
   -->
                            <Canvas Name="PART_TextCanvas" Grid.Column="1" Grid.Row="1" ClipToBounds="True">






 
                                <!--<ListBox Background="Transparent" HorizontalAlignment="Right" x:Name="lb" ClipToBounds="True" ItemsSource="{Binding Path=DataSeriesBar.Poly, RelativeSource={RelativeSource TemplatedParent}}" Foreground="#00000000">

                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Polygon Points="{Binding Path=Points}" Fill="DarkBlue"></Polygon>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <Canvas IsItemsHost="True" Background="#00000000"></Canvas>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                </ListBox>-->





                                <Canvas Name="PART_ChartCanvas" ClipToBounds="True">
                                </Canvas>
                            </Canvas>


















                            <ItemsControl Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Visible"
								ItemsSource="{Binding DataCollection.DataList,Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}">


                                <ItemsControl.Template>
                                    <ControlTemplate>
                                        <ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}">
                                            <ItemsPresenter />
                                        </ScrollViewer>
                                    </ControlTemplate>
                                </ItemsControl.Template>


                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Grid x:Name="grid" Background="#EBEBEB">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="20"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition/>
                                            </Grid.RowDefinitions>
                                            <Button IsHitTestVisible="True" Command="{Binding SelectFileCommand}" Height="15" Width="15" Background="{Binding FillColor}" BorderBrush="{Binding BorderColor}" BorderThickness="2" Margin="0,0,5,0"/>
                                            <TextBlock Grid.Column="1" Margin="3" Text="{Binding SeriesName}"/>
                                        </Grid>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>

                            </ItemsControl>
                        
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>